package com.neu.credit.creditscore.controller.common;


import com.neu.credit.creditscore.common.utils.Result;
import com.neu.credit.creditscore.service.common.FileService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;



@RestController
@RequestMapping("/pic")

public class PicController extends FileController{
    @Autowired
    public PicController(FileService fileService) {
        super(fileService);
    }

    @Override
    public String[] typeList() {
        return new String[]{
                ".jpg", ".png"
        };
    }

    @Override
    public String fileDir() {
        return "pic/";
    }

    @PostMapping

    @Override
    public Result<String> upload(MultipartFile file) {
        return super.upload(file);
    }

    @GetMapping("/{filename}")

    @Override
    public void download(@PathVariable String filename, HttpServletResponse response) {
        super.download(filename, response);
    }
}
